const arr = [0, 1,2,3,4,5,6,7,8,9];


Array.prototype.mePop = function() {
  if (this.length === 0) {
    return undefined;
  }
  const item = this[this.length - 1]
  this.length = this.length - 1;
  return item;
}


Array.prototype.myReverse = function() {
  let [right, left] = [0, this.length - 1];
  while (right < left) {
    [this[right], this[left]] = [this[left], this[right]];
    right ++;
    left --;
  }
}


Array.prototype.myPush = function(item) {
  this[this.length] = item;
  return item;
}


arr.myReverse();
arr.myPush(10);
console.log(arr);
